package com.smart.validate.utils;

import java.util.Collection;
import java.util.Map;

/**
 * Created by ZhangGang on 2017/8/31.
 */
public class CommonUtil {
    public static String defaultIfBlank(String str, String def) {
        return isNull(str) ? def : str;
    }

    public static boolean isNull(String str) {
        return null == str || str.isEmpty();
    }

    public static boolean isNull(Collection<?> collection) {
        return null == collection || collection.isEmpty();
    }

    public static boolean isNull(Map<?, ?> paramMap) {
        return null == paramMap || paramMap.isEmpty();
    }

    public static boolean isNull(Object[] array) {
        return null == array || array.length == 0;
    }
}
